Magic Square
Definition A magic square is an ''n'' by ''n'' array of numbers (usually consecutive from 1 to ''n''2) which has the property that each row, column, and main diagonal has the same sum. History The earliest recorded magic square was described by the Chinese; various dates are given, ranging from 2800 BCEGrogono, A. W. "A Mini-History of Magic Squares." ''Grogono Magic Squares''. Web. 8 July 2011. . to 650 BCE"Magic square." ''Wikipedia: The Free Encyclopedia''. Wikimedia Foundation, Inc. 4 July 2011. Web. 8 July 2011. . This magic square was known as the "Lo Shu" (scroll of the river Lo). The legend tells of a turtle which appeared from the water with a pattern on its shell (the Lo Shu), with the pattern allowing the people to control the river in the face of a great flood. The Lo Shu is identical to the 3 x 3 magic square in the above example, but uses patterns rather than numerals. Further information on the appearance of magic squares through history, as well as their cultural impact and significance, can be found in the Wikipedia article. Properties The "magic sum" for a normal magic square can be calculated by noting that the sum of the numbers contained within is: \sum_{i=1}^{n^2} i = \frac{n^2 (n^2 + 1)}{2} Since there are n rows (or columns), and since each row has the same magic sum, the magic sum is then: M = \frac{n (n^2 + 1)}{2} The 3 x 3 normal magic square is unique up to reflections and rotations. However, for larger values of n, the number of unique magic squares increases exponentially; the number of different magic squares for values of n from 1 to 5 (not counting reflections and rotations) is 1, 0, 1, 880, 275305224 ([http://oeis.org/A006052 A006052] in Sloane's On-line Encyclopedia of Integer SequencesSloane, N. J. A. "A006052 - OEIS." ''The On-Line Encyclopedia of Integer Sequences''. Web. 8 July 2011. .). Construction Elegant construction methods exist for three classes of magic square; those with odd order (n = 2k + 1), those with double even order (n = 4k), and those with singly even order (n = 4k + 2). For odd order magic squares, the [http://en.wikipedia.org/wiki/Siamese_method Siamese method] can be used. Starting with the top-middle cell, cells are filled sequentially by moving diagonally up and to the right, wrapping to the bottom row or left column as needed; when the diagonal path reencounters the starting number (after n steps), the next number is placed in the cell below, after which the diagonal movement resumes">"Siamese method." ''Wikipedia: The Free Encyclopedia''. Wikimedia Foundation, Inc. 8 May 2011. Web. 8 July 2011. . For a magic square with order divisible by four, a different method must be used. Starting with a "mystic square" (in which the numbers 1 to ''n''2 appear in order from left to right, top to bottom), certain cells are marked (the main diagonal of each 4 x 4 square). The numbers in these cells are then swapped with their diametrically opposite counterparts (that is, the numbers ''i'' and ''n'' + 1 - ''i'' are swapped), resulting in a magic square. For a singly even order magic square, the LUX method, found by J. H. Conway, can be usedWeisstein, Eric W. "Magic Square." ''MathWorld--A Wolfram Web Resource''. Web. 8 July 2011. . References